<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>Stalin Protocol Benchmark: TcpIp Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Stalin Protocol Benchmark
   </div>
   <div id="projectbrief">A Democratic benchmark by the people, for the people.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="class_tcp_ip-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">TcpIp Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Creates or listens to a Tcp/IP connection for sending and recieving data.  
 <a href="class_tcp_ip.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="_tcp_ip_8h_source.html">TcpIp.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a02d777e201cc83b63b80d4b0f0da5867"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_tcp_ip.html#a02d777e201cc83b63b80d4b0f0da5867">TcpIp</a> (void)</td></tr>
<tr class="memdesc:a02d777e201cc83b63b80d4b0f0da5867"><td class="mdescLeft">&#160;</td><td class="mdescRight"><b>Brief Description:</b> <a class="el" href="class_tcp_ip.html" title="Creates or listens to a Tcp/IP connection for sending and recieving data. ">TcpIp</a> default constructor.  <a href="#a02d777e201cc83b63b80d4b0f0da5867">More...</a><br/></td></tr>
<tr class="separator:a02d777e201cc83b63b80d4b0f0da5867"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a063576e534846f0e396aabadc1f40673"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_tcp_ip.html#a063576e534846f0e396aabadc1f40673">Connect</a> (const char *const ipAddress, int portNum)</td></tr>
<tr class="memdesc:a063576e534846f0e396aabadc1f40673"><td class="mdescLeft">&#160;</td><td class="mdescRight"><b>Brief Description:</b> Initiates a connection to another computer.  <a href="#a063576e534846f0e396aabadc1f40673">More...</a><br/></td></tr>
<tr class="separator:a063576e534846f0e396aabadc1f40673"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9480c3b6ef549b3626b031c63e168038"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_tcp_ip.html#a9480c3b6ef549b3626b031c63e168038">Listen</a> (int portNum)</td></tr>
<tr class="memdesc:a9480c3b6ef549b3626b031c63e168038"><td class="mdescLeft">&#160;</td><td class="mdescRight"><b>Brief Description:</b> Starts a listen server.  <a href="#a9480c3b6ef549b3626b031c63e168038">More...</a><br/></td></tr>
<tr class="separator:a9480c3b6ef549b3626b031c63e168038"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7fea212b99a95097982d588e9b02a07c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_tcp_ip.html#a7fea212b99a95097982d588e9b02a07c">Disconnect</a> (void)</td></tr>
<tr class="memdesc:a7fea212b99a95097982d588e9b02a07c"><td class="mdescLeft">&#160;</td><td class="mdescRight"><b>Brief Description:</b> Close current connection.  <a href="#a7fea212b99a95097982d588e9b02a07c">More...</a><br/></td></tr>
<tr class="separator:a7fea212b99a95097982d588e9b02a07c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1be8bd5ea7b0750e12af7e2f201778e5"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1be8bd5ea7b0750e12af7e2f201778e5"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>IsConnected</b> (void)</td></tr>
<tr class="separator:a1be8bd5ea7b0750e12af7e2f201778e5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae079636469eb882428a320882fe76910"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_tcp_ip.html#ae079636469eb882428a320882fe76910">ReadMsg</a> (unsigned short *size, char **message)</td></tr>
<tr class="memdesc:ae079636469eb882428a320882fe76910"><td class="mdescLeft">&#160;</td><td class="mdescRight"><b>Brief Description:</b> Reads a message from the TCP/IP stack  <a href="#ae079636469eb882428a320882fe76910">More...</a><br/></td></tr>
<tr class="separator:ae079636469eb882428a320882fe76910"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a13e3652bea5f965e1300bf7e635b86bb"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_tcp_ip.html#a13e3652bea5f965e1300bf7e635b86bb">SendMsg</a> (char type, unsigned short length, const char *message)</td></tr>
<tr class="memdesc:a13e3652bea5f965e1300bf7e635b86bb"><td class="mdescLeft">&#160;</td><td class="mdescRight"><b>Brief Description:</b> Sends a TLV message.  <a href="#a13e3652bea5f965e1300bf7e635b86bb">More...</a><br/></td></tr>
<tr class="separator:a13e3652bea5f965e1300bf7e635b86bb"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Creates or listens to a Tcp/IP connection for sending and recieving data. </p>
<p>The <a class="el" href="class_tcp_ip.html" title="Creates or listens to a Tcp/IP connection for sending and recieving data. ">TcpIp</a> class contains the methods required for establishing a TCP/IP connection. It is capable of either acting as a server and listening for connections, or attempting a connection to an already running server. In addition, 2 methods are provided for sending and receiving messages. Currently only 1 connection is supported. </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a02d777e201cc83b63b80d4b0f0da5867"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">TcpIp::TcpIp </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><b>Brief Description:</b> <a class="el" href="class_tcp_ip.html" title="Creates or listens to a Tcp/IP connection for sending and recieving data. ">TcpIp</a> default constructor. </p>
<p><b>Detailed Description:</b> Default constructor for the <a class="el" href="class_tcp_ip.html" title="Creates or listens to a Tcp/IP connection for sending and recieving data. ">TcpIp</a> class. It initializes the comSocket and portNum to known values. </p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a063576e534846f0e396aabadc1f40673"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int TcpIp::Connect </td>
          <td>(</td>
          <td class="paramtype">const char *const&#160;</td>
          <td class="paramname"><em>ipAddress</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>portNum</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><b>Brief Description:</b> Initiates a connection to another computer. </p>
<p><b>Detailed Description:</b> Connection method initiating a connection to another computer. Connects to the ip address specified on the port specified and prints the status of the connection to the screen.</p>
<p>[in] ipAddress <b> const char * const </b> The IP address of the computer to connect to. [in] portNum <b> int </b> The port number the connection will be made on.</p>
<dl class="section return"><dt>Returns</dt><dd>TBD <b> int </b> TBD </dd></dl>

</div>
</div>
<a class="anchor" id="a7fea212b99a95097982d588e9b02a07c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void TcpIp::Disconnect </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><b>Brief Description:</b> Close current connection. </p>
<p><b>Detailed Description:</b> Closes the connection if it is open. Applies to listening and connecting. </p>

</div>
</div>
<a class="anchor" id="a9480c3b6ef549b3626b031c63e168038"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int TcpIp::Listen </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>portNum</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><b>Brief Description:</b> Starts a listen server. </p>
<p><b>Detailed Description:</b> Starts a listen server for listening to and accepting incomming connections on the port number specified. Currently only accepts 1 connection at a time.</p>
<p>[in] portNum <b> int </b> The port number the listen server will listen on.</p>
<dl class="section return"><dt>Returns</dt><dd>TBD <b> int </b> TBD </dd></dl>

</div>
</div>
<a class="anchor" id="ae079636469eb882428a320882fe76910"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int TcpIp::ReadMsg </td>
          <td>(</td>
          <td class="paramtype">unsigned short *&#160;</td>
          <td class="paramname"><em>size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char **&#160;</td>
          <td class="paramname"><em>message</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><b>Brief Description:</b> Reads a message from the TCP/IP stack </p>
<p><b>Detailed Description:</b> Attempts to read a message if it exists from the TCP/IP stack. If a message exists, it will determine the type and length, and then allocate enough memory to finally store the message. A pointer to the message is returned to the caller which must be free'd by the caller at some point.</p>
<p>[out] size <b> unsigned short * </b> The length of the message received. [out] message <b> char * </b> The contents of the message in a byte array.</p>
<dl class="section return"><dt>Returns</dt><dd>messageType <b> int </b> The type of message received. -1 Means error. </dd></dl>

</div>
</div>
<a class="anchor" id="a13e3652bea5f965e1300bf7e635b86bb"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int TcpIp::SendMsg </td>
          <td>(</td>
          <td class="paramtype">char&#160;</td>
          <td class="paramname"><em>type</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned short&#160;</td>
          <td class="paramname"><em>length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>message</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><b>Brief Description:</b> Sends a TLV message. </p>
<p><b>Detailed Description:</b> Formats a message into the TLV and sends it across the network.</p>
<p>[in] portNum <b> int </b> The port number the listen server will listen on.</p>
<dl class="section return"><dt>Returns</dt><dd>bytes <b> int </b> The number of bytes sent. </dd></dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>trunk/IADA1/inc/<a class="el" href="_tcp_ip_8h_source.html">TcpIp.h</a></li>
<li>trunk/IADA1/src/<a class="el" href="_tcp_ip_8cpp.html">TcpIp.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue Jan 28 2014 20:53:42 for Stalin Protocol Benchmark by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>
